[General]
This displays the hints for creating an user-defined function. 
Place the cursor into the control, the related hint will be shown here.  

[Function Name] 
Specify Function Name in this edit box.
Note that spaces and special characters are not allowed and will be stripped out.
The function file on disk will have the same name with extension .FDF
Example: MyExpDecay

[File Name]
This is the file path for the FDF file.

[Brief Description]
Specify a brief description for the function in this edit box.
This description will be displayed on the function selection page of the NLFit dialog.
Example: My custom exponential decay function.

[Function Type]
There are two options for function type: "User-Defined" and "External DLL"
The "User-Defined" function type is most commonly used. 
With this type, user can define the function using Origin C or LabTalk, depending on the "Function Form" setting.
The "External DLL" function type is more advanced and this requires user to create a DLL using an external compiler. 
This function type is useful if fitting speed is a critical issue.

[Function Source]
Enter the name of the DLL and the fitting function (in the form of "DLLname.FunctionName").

[Independent Variables]
Enter independent variable names separated by comma (,) in this edit box.
Note that variable names need to be unique, so cannot define variables such as "x, X".
However, varible names are case sensitive when writing Origin C code for the fittig function.
Examples:
	x
	x, y
	Time
	Time, Rate

[Dependent Variables]
Enter dependent variable names separated by comma (,) in this edit box. 
Note that variable names need to be unique, so cannot define variables such as "y, Y".
However, varible names are case sensitive when writing Origin C code for the fittig function.
Examples:
	y
	y, z
	Pressure
	Pressure, Temperature

[Parameter Names]
Enter parameter names separated by comma (,) in this edit box. 
Note that parameter names need to be unique, so cannot define parameters such as "p1, P1".
However, parameter names are case sensitive when writing Origin C code for the fittig function.
Examples:
	P1, P2, P3
	a, b, c
	x0, xc, A, w
	Rate, Slope

[Function Form]
Function Form has the following choices (Note that Y-Script, Expression and Equation require LabTalk syntax while OriginC requires OriginC syntax):
Origin C:	This is most flexible and most common. This allows you to define the function using Origin C syntax
Expression:	This is limited to function definitions with a single dependent variable.
		The expression can only be in a single line.
Y-Script:	This allows using LabTalk script to define the function. 
		This option will be slower than Origin C and is mainly provided for backward compatibility with older versions.
Equations:	This is appropriate for one or more dependent variables.

[Function Expression] 
Define the function with the form of Expression. 
Note that it can only be in a single line and should follow LabTalk syntax.
Example:
	y0+A/(w*sqrt(PI/2))*exp(-2*((x-xc)/w)^2)

[Function YScript]
Define the function with the form of Y-Script. This should follow LabTalk syntax.
Example:
	//Gauss function.
	temp1 = A/(w*sqrt(PI/2));
	temp2 = -2*((x-xc)/w)^2;
	y = y0 + temp1 * exp(temp2);

[Function Equations]
Define the function with the form of Equations. This should follow LabTalk syntax.
Example: 
	y1 = a + b*x;
	y2 = a + c*exp(-b*x);

[Function OriginC]
Define the function with the form of Origin C. 
You can click the Code Builder button beside the edit box to edit the code in Code Builder.
Example: 
	// Define the Gauss function y = y0+A/(w*sqrt(PI/2)))*exp(-2*((x-xc)/w)^2)
	if (fabs(w)<1.e-8) { y = NANUM; return; }
	double dTemp = (x-xc)/w;
	dTemp = dTemp*dTemp;
	y = y0 + A*exp(-2.0*dTemp)/w/sqrt(PI/2.0);

[Function Description]
Add description for the External DLL. This will not affect the result of the function as it will be calculated using the external DLL.

[Parameter Settings]
This edit box can be used to set initial values for parameters, assign meanings/description to each parameter,
set upper and lower bounds, and to specify number of significant digits for displaying parameter value.
You can click the button to the right of the edit box to bring up a dialog to specify this information,
rather than typing in the edit box.

[Initialization Scripts]
This checkbox can be used to enable/disable the parameters initialization code specified in Parameter Initialization editbox.
Note that if this is checked the initial values for the parameters will be set according to the parameter initialization code 
rather than the initial values specified in Parameter Settings.

[Parameters Initialization]
This edit box can be used to specify Origin C code for computing initial parameter values.
Clicking the button next to the edit box opens the contents in Code Builder where user can type the Origin C code and test the code for successful compilation.
Tip: Functions commonly used for parameter initialization are defined in file <Origin Installation Folder>\OriginC\System\data.h.
Example:
	sort(x_y_curve);
	y0 = 0.5*(yatxmin(x_y_curve)+yatxmax(x_y_curve));
	w = 0.85 * fwhm( x_y_curve, y0 );
	A = area( x_y_curve, y0 );
	if ( A > 0 ) xc = xatymax( x_y_curve );
	else xc = xatymin( x_y_curve );
	if( w == NANUM ) w = 0.79 * fabs(A)/(max(y_data)-min(y_data));

[Script Before Fitting]
This edit box can be used to specify LabTalk script code to be executed before fitting.
This is typically used to perform some pre-processing of data prior to fitting.

[Script After Fitting]
This edit box can be used to specify LabTalk script code to be executed after the fitting process is done.
This is typically used to perform further computations based on fit parameters.

[General Linear Constraints]
This checkbox can be used to enable/disable the constraints specified in Constraints editbox.
Note that if this is enabled, it will have higher priority than the settings in  the bounds of Parameter Setting when the constraints also defined bounds.
For example, if the term a<3 is defined in Constraints while the upper bound for parameter a is 4, the fitter will take the constraint as a<3. 

[Constraints]
This edit box can be used to specify general linear constraints for the fit parameters. 
Multiple constraints should be separated using semicolon. 
Examples:
	a>b; a+2*b>=c*2-d; a<b<c; a/3<9;
Note that nonlinear constraints such as "a^2>c; a*b>3; 1/b>c+2; sin(a)<c;" are not allowed.

The following special notations can also be used in constraints:

(i): Refer to an initial value of a parameter. To restrict xc within the range +/- 1 by its initial value, use:
xc < xc(i)+1; xc > xc(i)-1; 

(a): Indicate all parameters of a family in replica fitting.  To set all the value of A smaller than 1, use:
A(a)<1;

(e): Indicate all parameters of a family, except the one preceding (e). To indicate the amplitude A__3 should be at least twice as large as all the other amplitudes, use:
A__3>=2*A__3(e)

(i) can combine with either (e) or (a). To indicate no peak center should deviate from its initial value by more than 0.2, use:
xc(ia) - xc(a) <= 0.2;
xc(a) - xc(ia) <= 0.2;

(n): The parameter index of replica peaks. For example:
w > w__2; w__2 > w__3; w__3 > w__4
can be written as:
w(n) > w(n+1), n=1..4;

[Derived Parameters]
This edit box can be used to define "Derived" parameters, which are additional parameters computed using the parameters used in the fitting process. 
These derived parameters are not involved in the fitting process and are computed only at the end of the fitting session. 
The values will be listed in Parameters Table of Report Tables worksheet.
Examples: 
	sigma = w/2; 
	FWHM = sqrt(2*ln(2)) * w;
	Height = A/(w*sqrt(PI/2));
Note that each derived parameter should be specified in a separate row, 
and one derived parameter cannot be used to compute another derived parameter.

